<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>   

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
</style>
<link rel="stylesheet" href="/css/app/common.css">
<link rel="stylesheet"  href="/css/app/upgrade-payment.css">
<script src="/js/app/jquery.min.js"></script>
<script src="/js/app/tip_pop.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>会员升级</title>
<script type="text/javascript">

/*去地址管理 ios  */
function fn_GoAddressInfo() {
	window.webkit.messageHandlers.ios_show_address.postMessage('');
}
/* IOS 购买套餐支付 */
function fn_memberUpgradePackagePayment_ios(paymentAmount) {
	if(!'${address_id}'){
		//window.webkit.messageHandlers.ios_open_page.postMessage('AddEditAddressViewController');
		tip("请选择收货地址",250);
		return false;
	}
	window.webkit.messageHandlers.ios_open_page.postMessage('MemberUpgradePaymentViewController:::packageId->${packageOne.package_id}:::selectedStandardId->${standard_id}:::addressId->${address_id}:::paymentAmount->'+paymentAmount+':::accountBalance->${free_cash}:::isPackage->YES:::jumpIndex->3');
}
/* android 购买套餐支付 */
function fn_memberUpgradePackagePayment_android(paymentAmount,recharge_ticket) {
	if(!'${address_id}'){
		//android.startCreateAddress();
		tip("请选择收货地址",250);
		return false;
	}
	android.startPay('${address_id}','${packageOne.package_id}','${standard_id}',paymentAmount,recharge_ticket);
}
</script>
</head>
<body>		
<div class="main">
		<div class="goods-block ">
		<input type="hidden" id="package_id" value="${p.package_id}" />
		<div id="change_ajax">
		<c:if test="${'ios'==os}">
			<h4 class="flex-layout">
				<p style="max-width:100%">${packageOne.package_name}</p>
			</h4>
		</c:if>
		<c:if test="${'android'==os}">
			<h4 class="flex-layout">
				<p style="max-width:100%">${packageOne.package_name}</p>
			</h4>
		</c:if>
				<div class="flex-layout topInner">
					<c:forEach items="${packageOne.good_list}" var="g">
						<div class="leftarea"><img src="${g.img}" alt="" style="width:100%;"></div>
						<div class="rightarea">
							<p class="goods-name">${g.name}</p>
							<p style="font-size:12px;color:#999;">${g.standard_name}</p>
							<p>&yen;${g.default_price}</p>
						</div>
					</c:forEach>
				</div>
				<div class="flex-layout botInner">
					<div class="leftarea"><img src="${ticket_logo}" alt="" style="width:50px;"></div>
					<div class="rightarea">
						<p class="goods-name">${packageOne.recharge_ticket}友米券</p>
						<p style="font-size:12px;color:#999;"><fmt:formatNumber value="${level_up_info.rate*10}" pattern="#0.0" maxFractionDigits="1"/>折友米券</p>
						<p>&yen;<fmt:formatNumber value="${level_up_info.recharge_ticket*level_up_info.rate}" pattern="#0.00" maxFractionDigits="2"/></p>
					</div>
				</div>
			</div>
			<c:if test="${'ios'==os}">
				<h4 class="flex-layout" style="border-top:10px solid #f1f2f3;" onclick="fn_GoAddressInfo()">
					<p>收货地址</p>
					<c:if test="${address ==null}">
						<p>请选择收货地址 </p>
					</c:if>
					<c:if test="${address !=null}">
						<p>${address }</p>
					</c:if>
				</h4>
			</c:if>
			<c:if test="${'android'==os}">
				<c:if test="${address_id==null}">
				<h4 class="flex-layout" style="border-top:10px solid #f1f2f3;" onclick="android.startAddressChioce('')">
				</c:if>
				<c:if test="${address_id!=null}">
				<h4 class="flex-layout" style="border-top:10px solid #f1f2f3;" onclick="android.startAddressChioce(${address_id})">
				</c:if>
					<p>收货地址</p>
					<c:if test="${address ==null}">
						<p>请选择收货地址 </p>
					</c:if>
					<c:if test="${address !=null}">
						<p>${address }</p>
					</c:if>
				</h4>
			</c:if>
		</div>
		
		<div class="footer">
			<div style="text-align: right;">
				<c:forEach items="${packageOne.good_list}" var="g">
					<p style="color:#f34545;display:inline-block;">实付款：&yen;${g.default_price}</p>
				</c:forEach>
					<c:if test="${'ios'==os}">
					<button onclick="fn_memberUpgradePackagePayment_ios('${packageOne.defaultPrice}')">立即支付</button>
					</c:if>
					<c:if test="${'android'==os}">
					<button onclick="fn_memberUpgradePackagePayment_android(${packageOne.defaultPrice},'${packageOne.recharge_ticket}')">立即支付</button>
				</c:if>
			</div>
		</div>
	</div>
</body>
</html>